import request from "@/util/request.js";
import axios from "axios";

export const uploadFileApi = (params) => {
  return request.post("/api/upload", params);
};

export const downloadFileApi = (name) => {
  return request.post(`/api/download/${name}`);
};

export const getFileApi = (name) => {
  // return request.post(`/api/getFile/${name}`);
  return axios({
    url: `/api/getFile/${name}`,
    method: "POST",
    responseType: "blob"
  });
};

export const saveDataApi = (params) => {
  return request.post("/api/save", params);
};

export const searchDataApi = (params) => {
  return request.post("/api/search", params);
};

export const deleteFileApi = (name) => {
  return request.post(`/api/delete/${name}`);
};
